/**
 * Created with IntelliJ IDEA.
 * User: skyline{http://my.oschina.net/skyline520}
 * Date: 12-11-19
 * Time: 上午9:27
 * To change this template use File | Settings | File Templates.
 */
Ext.define('Airways.view.system.operation.LeftPanel',{
    extend:'Ext.tree.Panel',
    alias:'widget.leftPanel',
    iconCls:'edit',
    title:'系统菜单树',
    collapsible:true,
    enableDD:true,
    viewConfig: {
        plugins: {
            ptype: 'treeviewdragdrop',
            allowParentInserts:true,
            appendOnly:false
        },
        listeners: {
            drop: function (node, data, overModel, dropPosition,opts) {
                var indexObj = new Object();
                indexObj.parentId = data.records[0].get('parentId');
                indexObj.operationId = data.records[0].get('operationId');
                indexObj.menuIndex = data.records[0].get('index');
                indexObj.menuLevel = data.records[0].get('depth')-1;
                indexObj.version = data.records[0].get('version');
                this.addEvents("changeIndexDrop");
                this.fireEvent('changeIndexDrop',indexObj);
            },
            beforedrop: function (node, data, overModel, dropPosition,opts){
                var indexObj = new Object();
                indexObj.oldParentId = data.records[0].get('parentId');
                indexObj.oldMenuIndex = data.records[0].get('index');
                indexObj.oldMenuLevel = data.records[0].get('depth')-1;
                this.addEvents("changeIndexBeforeDrop");
                this.fireEvent('changeIndexBeforeDrop',indexObj);
            }
        }
    },
    autoScroll: true,
    enableDragDrop:false,
    split: true,
    rootVisible:false,
    lines:true,
    containerScroll: true,
    height:800,
    width:200,
    store:'system.operation.OperationManageStore',
    initComponent:function (){
        this.callParent(arguments);
    }
});
